package chpt03;

import java.util.Arrays;

class CarDriver {
	private String name;

	public CarDriver() {
	};

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "CarDriver [name=" + name + "]";
	}

}

class Car implements Cloneable {
	private String name;
	private CarDriver driver;
	private int[] scores;

	public Car() {
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public CarDriver getDriver() {
		return driver;
	}

	public void setDriver(CarDriver driver) {
		this.driver = driver;
	}

	public int[] getScores() {
		return scores;
	}

	public void setScores(int[] scores) {
		this.scores = scores;
	}

	@Override
	public String toString() {
		return "Car [name=" + name + ", driver=" + driver + ", scores=" + Arrays.toString(scores) + "]";
	}

	public Car clone() throws CloneNotSupportedException {
		Car cloned = (Car) super.clone();
		cloned.name = (String) name;
		cloned.driver = (CarDriver) driver;
		cloned.scores = (int[]) scores.clone();
		return cloned;
	}

}
